<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddColumnIsAssembleInTaskAndUpstreamTable extends AbstractMigration
{
    public function up()
    {
        $this->table('order_task_upstream_version')->addColumn('is_assemble', 'enum', [
            'values' => 'yes,no',
            'default' => 'no',
            'null' => false,
            'comment' => '是否已组装文件给下游',
        ])->save();
        // 上线前 需要把所有已完成的任务 全部标记为已组装
        $this->table('task')->addColumn('is_assemble', 'enum', [
            'values' => 'yes,no',
            'default' => 'no',
            'null' => false,
            'comment' => '是否已组装文件给下游',
        ])->save();
    }

    public function down()
    {
        $this->table('order_task_upstream_version')->removeColumn('is_assemble')->save();
        $this->table('task')->removeColumn('is_assemble')->save();
    }
}
